_editor_url = "";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
 document.write('<scr' + 'ipt src="js/editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>');  
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }


function log_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Are you sure you want to LOG OUT?'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}
function rollon(a) 
{
		a.style.backgroundColor="#ECF5FF";
}	
function rolloff(a) 
{
		a.style.backgroundColor='';	
}
function cbset_value(form_name,cb_name,cball_name)
{
	var bln_allbox = document.forms[form_name].elements[cball_name].checked;
	if(bln_allbox) cbvalue = document.forms[form_name].elements[cball_name].value;
	else cbvalue = 0;
	document.forms[form_name].elements[cb_name].value = cbvalue;
}

function set_all_cb(form_name,cb_name,cball_name)
{
	var cb      = document.forms[form_name].elements[cb_name];
	var cb_len  = cb.length;
	var bln_allbox = document.forms[form_name].elements[cball_name].checked;
	for (var i = 0; i < cb_len; i++) 
	{
		cb[i].checked = bln_allbox;
	}
}

function set_menu(current_div)
{
	// Set all div class to menu1td
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'menu1td_on') x[i].className = 'menu1td';
	}
	
	// Set the current div class to menu1td_on
	document.getElementById(current_div).className = 'menu1td_on';
}

function check_all_cb(form_name,cb_name,cball_name)
{
	var cb      = document.forms[form_name].elements[cb_name];
	var cb_len  = cb.length;
	var bln_allbox = document.forms[form_name].elements[cball_name].checked;
	if(bln_allbox==true)
	{
		for (var i = 0; i < cb_len; i++) 
		{
			cb[i].checked = true;
		}
	}
}

function exp_res(div_id,img_name)
{
	if(div_id.style.display == "inline")
	{ 	
		div_id.style.display = "none"; 
		/*if(img_name.src == btn_min.src) img_name.src = btn_max.src;
		else img_name.src = btn_min.src;*/
	}
	else
	{ 
		div_id.style.display = "inline";
		/*if(img_name.src== btn_min.src) img_name.src = btn_max.src;
		else img_name.src = btn_min.src;*/
	};
}
function on_off(div_id)
{
	div_id.style.display = "none";
}
function go(url)
{
	parent.location = url;
}
function menu_jump(url){	
	if (url.substring(0,5) != "")
	{
		window.location=url;
	}
	else return false;
}
function menu_submit(data,form)
{
	if (data != "")
	{ 
		form.action=document.URL;
		form.submit();
	}
	else return false;
}
function ask(url,msg)
{
	if (!confirm(msg))
	{ //do nothing
	}
	else 
	{parent.location = url;}
}

function popup(url,width,height) 
{
	OpenWin = this.open(url,"_blank", "toolbar=no,menubar=no,location=no,scrollbars=no,status=no,resize=no,resizable=yes,width="+width+",height="+height+",top=100,left=100'");
}


function load_chart_month(vyear)
{
		document.forms['select_year'].elements['current_year'].value = vyear;
		document.getElementById('chart_visit_month').innerHTML = '<iframe name="frm_vpm" id="frm_vpm" src="jcas_modules/chart/visit_per_month.php?year=' + vyear + '&rand=' + new Date().getTime() + '" width="600" height="300" frameborder="0" scrolling="no"></iframe>';
		document.getElementById('chart_visit_day').innerHTML = '<iframe name="frm_vpd" id="frm_vpd" src="jcas_modules/chart/visit_per_day.php?year=' + vyear + '&month=1&rand=' + new Date().getTime() + '" width="600" height="300" frameborder="0" scrolling="no"></iframe>';
}
	
function load_chart_day(vmonth)
{
		vyear = document.forms['select_year'].elements['current_year'].value;
		document.getElementById('chart_visit_day').innerHTML = '<iframe name="frm_vpd" id="frm_vpd" src="jcas_modules/chart/visit_per_day.php?year=' + vyear + '&month=' + vmonth + '&rand=' + new Date().getTime() + '" width="600" height="300" frameborder="0" scrolling="no"></iframe>';
}